View Javadoc

1   // NullDelegates.java, created Wed Dec 11 12:02:02 2002 by mcmartin
2   // Copyright (C) 2001-3 mcmartin
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.Class;
5   
6   import java.util.Iterator;
7   import joeq.Memory.CodeAddress;
8   import joeq.Memory.StackAddress;
9   import jwutil.util.Assert;
10  
11  /***
12   * NullDelegates
13   *
14   * @author Michael Martin <mcmartin@stanford.edu>
15   * @version $Id: NullDelegates.java 1931 2004-09-22 22:17:47Z joewhaley $
16   */
17  abstract class NullDelegates {
18      static class Field implements jq_Field.Delegate {
19          public final boolean isCodeAddressType(jq_Field f) { return false; }
20          public final boolean isHeapAddressType(jq_Field f) { return false; }
21          public final boolean isStackAddressType(jq_Field f) { return false; }
22      }
23  
24      static class Method implements jq_Method.Delegate {
25          public final jq_CompiledCode compile_stub (jq_Method m) {
26              return null;
27          }
28          public final jq_CompiledCode compile (jq_Method m) {
29              return null;
30          }
31      }
32  
33      static class CompiledCode implements jq_CompiledCode.Delegate {
34          public final void patchDirectBindCalls (Iterator i) { }
35          public final void patchDirectBindCalls (Iterator i, jq_Method m, jq_CompiledCode cc) { }
36          public final Iterator getCompiledMethods () { 
37              return new java.util.LinkedList().iterator();
38          }
39          public final void deliverToStackFrame(Object ed, jq_CompiledCode t, Throwable x, jq_TryCatch tc, CodeAddress entry, StackAddress fp) { }
40          public final Object getThisPointer(Object ed, jq_CompiledCode t, CodeAddress ip, StackAddress fp) { return null; }
41      }
42  
43      static class Klass implements jq_Class.Delegate {
44          public final Object newInstance(jq_Class c, int instance_size, Object vtable) {
45              try {
46                  return Class.forName(c.getName()).newInstance();
47              } catch (Exception e) { return null; }
48          }
49      }
50  
51      static class Array implements jq_Array.Delegate {
52          public final Object newInstance(jq_Array a, int length, Object vtable) {
53              Assert.UNREACHABLE("Can't create new arrays!");
54              return null;
55          }
56      }
57  }